package org.sems.sems.Controller;

import org.sems.sems.entity.Dcwjhdk;
import org.sems.sems.entity.Dcwjk;
import org.sems.sems.service.DcwjkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/dcwjk")
public class DcwjkController {
    @Autowired
    private DcwjkService dcwjkService;
    // 获取调查问卷
    @RequestMapping("/getDcwjk")
    public Map<String, Object> getDcwjk(int dcwjid) {
        return dcwjkService.getDcwjk(dcwjid);
    }

    //新增调查问卷
    @PostMapping("/addDcwjk")
    public Map<String, Object> addDcwjk( Dcwjk dcwjk) {
        return dcwjkService.addDcwjk(dcwjk);
    }

    // 获取调查问卷列表
    @RequestMapping("/getDcwjkList")
    public Map<String, Object> getDcwjkList(String yhm,int fbzsfdm ) {
        return dcwjkService.getDcwjkList(yhm,fbzsfdm);
    }

    // 新增调查问卷回答
    @PostMapping("/addDcwjkAnswer")
    public Map<String, Object> addDcwjkAnswer( Dcwjhdk dcwjhdk) {
        System.out.println(dcwjhdk);
        return dcwjkService.addDcwjkAnswer(dcwjhdk);
    }

    // 获取调查问卷回答
    @RequestMapping("/getDcwjkAnswer")
    public Map<String, Object> getDcwjkAnswerList(int dcwjid) {
        return dcwjkService.getDcwjkAnswer(dcwjid);
    }
    //学生
    @GetMapping("/getDcwjkAnswerList")
    public Map<String, Object> getDcwjkAnswerList(String yhm) {
        return   dcwjkService.getDcwjkAnswerList(yhm);
    }
    // 教师
    @GetMapping("/getDcwjkAnswerList2")
    public Map<String, Object> getDcwjkAnswerList2(String yhm) {
        return   dcwjkService.getDcwjkAnswerListTeacher(yhm);
    }}
